package com.realworld.common;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.Signature;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

import java.util.Arrays;


@Aspect
@Component
public class LoginAspect {
    // 待定，过滤器的时候用
    @Pointcut("execution(* com.realworld.controller.UserInfoController.hello(..))")
    public void pointcut(){
    }

    // 忘记要干啥了 后面的delete都要优化
    @Before("pointcut()")
    public void test(JoinPoint joinPoint){
        Signature signature = joinPoint.getSignature();
        Object[] args = joinPoint.getArgs();
        System.out.println(1);
        System.out.println("方法名："+signature.getName()+",参数："+ Arrays.toString(args));
    }
}
